﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AutoUpdateService.Server
{
    using DotNetty.Buffers;
    using DotNetty.Transport.Channels;
    using DotNetty.Handlers.Timeout;
    public class ServerIdleStateTrigger : ChannelHandlerAdapter
    {
        public override void UserEventTriggered(IChannelHandlerContext context, object evt)
        {
            if (evt is IdleStateEvent)
            {
                IdleState state = ((IdleStateEvent)evt).State;
                if (state == IdleState.ReaderIdle)
                {
                    context.DisconnectAsync();
                }
            }
            else
            {
                base.UserEventTriggered(context, evt);
            }
            //
        }
    }
}
